package androidx.appcompat.widget;

import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.PorterDuff.Mode;
import android.graphics.Rect;
import android.graphics.Region.Op;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.text.Layout;
import android.text.Layout.Alignment;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.TransformationMethod;
import android.util.AttributeSet;
import android.util.Property;
import android.view.ActionMode.Callback;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.CompoundButton;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import androidx.core.widget.TextViewCompat;
import com.huawei.appgallery.festivalanimation.particle.modifiers.SizeModifier;
import o.ah.c;
import o.ah.g;
import o.ar;
import o.av;
import o.cl;
import o.cw;
import o.de;
import o.gg;

public class SwitchCompat extends CompoundButton {
    private static final Property<SwitchCompat, Float> ˎ = new Property<SwitchCompat, Float>(Float.class, "thumbPos") {
        public /* synthetic */ Object get(Object obj) {
            return ˏ((SwitchCompat) obj);
        }

        public /* synthetic */ void set(Object obj, Object obj2) {
            ॱ((SwitchCompat) obj, (Float) obj2);
        }

        public Float ˏ(SwitchCompat switchCompat) {
            return Float.valueOf(switchCompat.ˏ);
        }

        public void ॱ(SwitchCompat switchCompat, Float f) {
            switchCompat.ॱ(f.floatValue());
        }
    };
    private static final int[] ͺॱ = new int[]{16842912};
    private ColorStateList ʻ;
    private CharSequence ʻॱ;
    private boolean ʼ;
    private VelocityTracker ʼॱ;
    private Drawable ʽ;
    private float ʽॱ;
    private int ʾ;
    private int ʿ;
    private float ˈ;
    private int ˉ;
    private Drawable ˊ;
    private int ˊˊ;
    private int ˊˋ;
    private Mode ˊॱ;
    private int ˊᐝ;
    ObjectAnimator ˋ;
    private int ˋˊ;
    private int ˋˋ;
    private boolean ˋॱ;
    private final TextPaint ˋᐝ;
    private int ˌ;
    private ColorStateList ˍ;
    private int ˎˎ;
    private final Rect ˎˏ;
    float ˏ;
    private TransformationMethod ˏˎ;
    private Layout ˏˏ;
    private int ˏॱ;
    private Layout ˑ;
    private boolean ͺ;
    private ColorStateList ॱ;
    private int ॱˊ;
    private boolean ॱˋ;
    private boolean ॱˎ;
    private Mode ॱॱ;
    private CharSequence ॱᐝ;
    private boolean ᐝ;
    private int ᐝॱ;

    public SwitchCompat(Context context) {
        this(context, null);
    }

    public SwitchCompat(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, c.ˎˏ);
    }

    public SwitchCompat(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.ॱ = null;
        this.ॱॱ = null;
        this.ᐝ = false;
        this.ʼ = false;
        this.ʻ = null;
        this.ˊॱ = null;
        this.ͺ = false;
        this.ˋॱ = false;
        this.ʼॱ = VelocityTracker.obtain();
        this.ˎˏ = new Rect();
        this.ˋᐝ = new TextPaint(1);
        Resources resources = getResources();
        this.ˋᐝ.density = resources.getDisplayMetrics().density;
        cw ॱ = cw.ॱ(context, attributeSet, g.ˏﹳ, i, 0);
        this.ˊ = ॱ.ˋ(g.ͺͺ);
        if (this.ˊ != null) {
            this.ˊ.setCallback(this);
        }
        this.ʽ = ॱ.ˋ(g.ـˏ);
        if (this.ʽ != null) {
            this.ʽ.setCallback(this);
        }
        this.ॱᐝ = ॱ.ˊ(g.ˮ);
        this.ʻॱ = ॱ.ˊ(g.ˡ);
        this.ॱˎ = ॱ.ˋ(g.ˬ, true);
        this.ˏॱ = ॱ.ˎ(g.ـᐝ, 0);
        this.ॱˊ = ॱ.ˎ(g.ߴॱ, 0);
        this.ᐝॱ = ॱ.ˎ(g.ߵॱ, 0);
        this.ॱˋ = ॱ.ˋ(g.ٴॱ, false);
        ColorStateList ॱ2 = ॱ.ॱ(g.ˑᐝ);
        if (ॱ2 != null) {
            this.ॱ = ॱ2;
            this.ᐝ = true;
        }
        Mode ˏ = cl.ˏ(ॱ.ॱ(g.ՙॱ, -1), null);
        if (this.ॱॱ != ˏ) {
            this.ॱॱ = ˏ;
            this.ʼ = true;
        }
        if (this.ᐝ || this.ʼ) {
            ˏ();
        }
        ॱ2 = ॱ.ॱ(g.יॱ);
        if (ॱ2 != null) {
            this.ʻ = ॱ2;
            this.ͺ = true;
        }
        ˏ = cl.ˏ(ॱ.ॱ(g.ـˎ, -1), null);
        if (this.ˊॱ != ˏ) {
            this.ˊॱ = ˏ;
            this.ˋॱ = true;
        }
        if (this.ͺ || this.ˋॱ) {
            ˊ();
        }
        int ॱॱ = ॱ.ॱॱ(g.ߺॱ, 0);
        if (ॱॱ != 0) {
            setSwitchTextAppearance(context, ॱॱ);
        }
        ॱ.ॱ();
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        this.ʾ = viewConfiguration.getScaledTouchSlop();
        this.ˊˊ = viewConfiguration.getScaledMinimumFlingVelocity();
        refreshDrawableState();
        setChecked(isChecked());
    }

    public void setSwitchTextAppearance(Context context, int i) {
        cw ˊ = cw.ˊ(context, i, g.ۥ);
        ColorStateList ॱ = ˊ.ॱ(g.ॱߴ);
        if (ॱ != null) {
            this.ˍ = ॱ;
        } else {
            this.ˍ = getTextColors();
        }
        int ˎ = ˊ.ˎ(g.ॱʹ, 0);
        if (!(ˎ == 0 || ((float) ˎ) == this.ˋᐝ.getTextSize())) {
            this.ˋᐝ.setTextSize((float) ˎ);
            requestLayout();
        }
        ˊ(ˊ.ॱ(g.ॱי, -1), ˊ.ॱ(g.ॱٴ, -1));
        if (ˊ.ˋ(g.ॱⁱ, false)) {
            this.ˏˎ = new av(getContext());
        } else {
            this.ˏˎ = null;
        }
        ˊ.ॱ();
    }

    private void ˊ(int i, int i2) {
        Typeface typeface = null;
        switch (i) {
            case 1:
                typeface = Typeface.SANS_SERIF;
                break;
            case 2:
                typeface = Typeface.SERIF;
                break;
            case 3:
                typeface = Typeface.MONOSPACE;
                break;
        }
        setSwitchTypeface(typeface, i2);
    }

    public void setSwitchTypeface(Typeface typeface, int i) {
        boolean z = false;
        if (i > 0) {
            Typeface defaultFromStyle;
            int style;
            float f;
            if (typeface == null) {
                defaultFromStyle = Typeface.defaultFromStyle(i);
            } else {
                defaultFromStyle = Typeface.create(typeface, i);
            }
            setSwitchTypeface(defaultFromStyle);
            if (defaultFromStyle != null) {
                style = defaultFromStyle.getStyle();
            } else {
                style = 0;
            }
            style = (style ^ -1) & i;
            TextPaint textPaint = this.ˋᐝ;
            if ((style & 1) != 0) {
                z = true;
            }
            textPaint.setFakeBoldText(z);
            TextPaint textPaint2 = this.ˋᐝ;
            if ((style & 2) != 0) {
                f = -0.25f;
            } else {
                f = 0.0f;
            }
            textPaint2.setTextSkewX(f);
            return;
        }
        this.ˋᐝ.setFakeBoldText(false);
        this.ˋᐝ.setTextSkewX(0.0f);
        setSwitchTypeface(typeface);
    }

    public void setSwitchTypeface(Typeface typeface) {
        if ((this.ˋᐝ.getTypeface() != null && !this.ˋᐝ.getTypeface().equals(typeface)) || (this.ˋᐝ.getTypeface() == null && typeface != null)) {
            this.ˋᐝ.setTypeface(typeface);
            requestLayout();
            invalidate();
        }
    }

    public void setSwitchPadding(int i) {
        this.ᐝॱ = i;
        requestLayout();
    }

    public void setSwitchMinWidth(int i) {
        this.ॱˊ = i;
        requestLayout();
    }

    public void setThumbTextPadding(int i) {
        this.ˏॱ = i;
        requestLayout();
    }

    public void setTrackDrawable(Drawable drawable) {
        if (this.ʽ != null) {
            this.ʽ.setCallback(null);
        }
        this.ʽ = drawable;
        if (drawable != null) {
            drawable.setCallback(this);
        }
        requestLayout();
    }

    public void setTrackResource(int i) {
        setTrackDrawable(ar.ˋ(getContext(), i));
    }

    public void setTrackTintList(@Nullable ColorStateList colorStateList) {
        this.ʻ = colorStateList;
        this.ͺ = true;
        ˊ();
    }

    @Nullable
    public ColorStateList ˋ() {
        return this.ʻ;
    }

    public void setTrackTintMode(@Nullable Mode mode) {
        this.ˊॱ = mode;
        this.ˋॱ = true;
        ˊ();
    }

    private void ˊ() {
        if (this.ʽ == null) {
            return;
        }
        if (this.ͺ || this.ˋॱ) {
            this.ʽ = this.ʽ.mutate();
            if (this.ͺ) {
                gg.ॱ(this.ʽ, this.ʻ);
            }
            if (this.ˋॱ) {
                gg.ˋ(this.ʽ, this.ˊॱ);
            }
            if (this.ʽ.isStateful()) {
                this.ʽ.setState(getDrawableState());
            }
        }
    }

    public void setThumbDrawable(Drawable drawable) {
        if (this.ˊ != null) {
            this.ˊ.setCallback(null);
        }
        this.ˊ = drawable;
        if (drawable != null) {
            drawable.setCallback(this);
        }
        requestLayout();
    }

    public void setThumbResource(int i) {
        setThumbDrawable(ar.ˋ(getContext(), i));
    }

    public void setThumbTintList(@Nullable ColorStateList colorStateList) {
        this.ॱ = colorStateList;
        this.ᐝ = true;
        ˏ();
    }

    @Nullable
    public ColorStateList ॱ() {
        return this.ॱ;
    }

    public void setThumbTintMode(@Nullable Mode mode) {
        this.ॱॱ = mode;
        this.ʼ = true;
        ˏ();
    }

    private void ˏ() {
        if (this.ˊ == null) {
            return;
        }
        if (this.ᐝ || this.ʼ) {
            this.ˊ = this.ˊ.mutate();
            if (this.ᐝ) {
                gg.ॱ(this.ˊ, this.ॱ);
            }
            if (this.ʼ) {
                gg.ˋ(this.ˊ, this.ॱॱ);
            }
            if (this.ˊ.isStateful()) {
                this.ˊ.setState(getDrawableState());
            }
        }
    }

    public void setSplitTrack(boolean z) {
        this.ॱˋ = z;
        invalidate();
    }

    public void setTextOn(CharSequence charSequence) {
        this.ॱᐝ = charSequence;
        requestLayout();
    }

    public void setTextOff(CharSequence charSequence) {
        this.ʻॱ = charSequence;
        requestLayout();
    }

    public void setShowText(boolean z) {
        if (this.ॱˎ != z) {
            this.ॱˎ = z;
            requestLayout();
        }
    }

    public void onMeasure(int i, int i2) {
        int intrinsicWidth;
        int intrinsicHeight;
        int max;
        int i3 = 0;
        if (this.ॱˎ) {
            if (this.ˏˏ == null) {
                this.ˏˏ = ˎ(this.ॱᐝ);
            }
            if (this.ˑ == null) {
                this.ˑ = ˎ(this.ʻॱ);
            }
        }
        Rect rect = this.ˎˏ;
        if (this.ˊ != null) {
            this.ˊ.getPadding(rect);
            intrinsicWidth = (this.ˊ.getIntrinsicWidth() - rect.left) - rect.right;
            intrinsicHeight = this.ˊ.getIntrinsicHeight();
        } else {
            intrinsicHeight = 0;
            intrinsicWidth = 0;
        }
        if (this.ॱˎ) {
            max = Math.max(this.ˏˏ.getWidth(), this.ˑ.getWidth()) + (this.ˏॱ * 2);
        } else {
            max = 0;
        }
        this.ˊˋ = Math.max(max, intrinsicWidth);
        if (this.ʽ != null) {
            this.ʽ.getPadding(rect);
            i3 = this.ʽ.getIntrinsicHeight();
        } else {
            rect.setEmpty();
        }
        max = rect.left;
        intrinsicWidth = rect.right;
        if (this.ˊ != null) {
            rect = cl.ˏ(this.ˊ);
            max = Math.max(max, rect.left);
            intrinsicWidth = Math.max(intrinsicWidth, rect.right);
        }
        intrinsicWidth = Math.max(this.ॱˊ, intrinsicWidth + (max + (this.ˊˋ * 2)));
        intrinsicHeight = Math.max(i3, intrinsicHeight);
        this.ˊᐝ = intrinsicWidth;
        this.ˉ = intrinsicHeight;
        super.onMeasure(i, i2);
        if (getMeasuredHeight() < intrinsicHeight) {
            setMeasuredDimension(getMeasuredWidthAndState(), intrinsicHeight);
        }
    }

    public void onPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        super.onPopulateAccessibilityEvent(accessibilityEvent);
        Object obj = isChecked() ? this.ॱᐝ : this.ʻॱ;
        if (obj != null) {
            accessibilityEvent.getText().add(obj);
        }
    }

    private Layout ˎ(CharSequence charSequence) {
        int ceil;
        CharSequence transformation = this.ˏˎ != null ? this.ˏˎ.getTransformation(charSequence, this) : charSequence;
        TextPaint textPaint = this.ˋᐝ;
        if (transformation != null) {
            ceil = (int) Math.ceil((double) Layout.getDesiredWidth(transformation, this.ˋᐝ));
        } else {
            ceil = 0;
        }
        return new StaticLayout(transformation, textPaint, ceil, Alignment.ALIGN_NORMAL, 1.0f, 0.0f, true);
    }

    private boolean ˊ(float f, float f2) {
        if (this.ˊ == null) {
            return false;
        }
        int ʽ = ʽ();
        this.ˊ.getPadding(this.ˎˏ);
        int i = this.ˎˎ - this.ʾ;
        ʽ = (ʽ + this.ˋˊ) - this.ʾ;
        int i2 = (((this.ˊˋ + ʽ) + this.ˎˏ.left) + this.ˎˏ.right) + this.ʾ;
        int i3 = this.ˌ + this.ʾ;
        if (f <= ((float) ʽ) || f >= ((float) i2) || f2 <= ((float) i) || f2 >= ((float) i3)) {
            return false;
        }
        return true;
    }

    public boolean onTouchEvent(MotionEvent motionEvent) {
        this.ʼॱ.addMovement(motionEvent);
        float x;
        float y;
        switch (motionEvent.getActionMasked()) {
            case 0:
                x = motionEvent.getX();
                y = motionEvent.getY();
                if (isEnabled() && ˊ(x, y)) {
                    this.ʿ = 1;
                    this.ʽॱ = x;
                    this.ˈ = y;
                    break;
                }
            case 1:
            case 3:
                if (this.ʿ != 2) {
                    this.ʿ = 0;
                    this.ʼॱ.clear();
                    break;
                }
                ॱ(motionEvent);
                super.onTouchEvent(motionEvent);
                return true;
            case 2:
                switch (this.ʿ) {
                    case 0:
                        break;
                    case 1:
                        x = motionEvent.getX();
                        y = motionEvent.getY();
                        if (Math.abs(x - this.ʽॱ) > ((float) this.ʾ) || Math.abs(y - this.ˈ) > ((float) this.ʾ)) {
                            this.ʿ = 2;
                            getParent().requestDisallowInterceptTouchEvent(true);
                            this.ʽॱ = x;
                            this.ˈ = y;
                            return true;
                        }
                    case 2:
                        float x2 = motionEvent.getX();
                        int ʼ = ʼ();
                        float f = x2 - this.ʽॱ;
                        x = ʼ != 0 ? f / ((float) ʼ) : f > 0.0f ? 1.0f : SizeModifier.STABLE_STATE_SCALE;
                        if (de.ˎ(this)) {
                            x = -x;
                        }
                        x = ˋ(x + this.ˏ, 0.0f, 1.0f);
                        if (x != this.ˏ) {
                            this.ʽॱ = x2;
                            ॱ(x);
                        }
                        return true;
                    default:
                        break;
                }
                break;
        }
        return super.onTouchEvent(motionEvent);
    }

    private void ˊ(MotionEvent motionEvent) {
        MotionEvent obtain = MotionEvent.obtain(motionEvent);
        obtain.setAction(3);
        super.onTouchEvent(obtain);
        obtain.recycle();
    }

    private void ॱ(MotionEvent motionEvent) {
        boolean z = true;
        this.ʿ = 0;
        boolean z2 = motionEvent.getAction() == 1 && isEnabled();
        boolean isChecked = isChecked();
        if (z2) {
            this.ʼॱ.computeCurrentVelocity(1000);
            float xVelocity = this.ʼॱ.getXVelocity();
            if (Math.abs(xVelocity) <= ((float) this.ˊˊ)) {
                z = ᐝ();
            } else if (de.ˎ(this)) {
                if (xVelocity >= 0.0f) {
                    z = false;
                }
            } else if (xVelocity <= 0.0f) {
                z = false;
            }
        } else {
            z = isChecked;
        }
        if (z != isChecked) {
            playSoundEffect(0);
        }
        setChecked(z);
        ˊ(motionEvent);
    }

    private void ˋ(boolean z) {
        float f = z ? 1.0f : 0.0f;
        this.ˋ = ObjectAnimator.ofFloat(this, ˎ, new float[]{f});
        this.ˋ.setDuration(250);
        if (VERSION.SDK_INT >= 18) {
            this.ˋ.setAutoCancel(true);
        }
        this.ˋ.start();
    }

    private void ˎ() {
        if (this.ˋ != null) {
            this.ˋ.cancel();
        }
    }

    private boolean ᐝ() {
        return this.ˏ > 0.5f;
    }

    void ॱ(float f) {
        this.ˏ = f;
        invalidate();
    }

    public void toggle() {
        setChecked(!isChecked());
    }

    public void setChecked(boolean z) {
        super.setChecked(z);
        boolean isChecked = isChecked();
        if (getWindowToken() == null || !ViewCompat.ˊᐝ(this)) {
            ˎ();
            ॱ(isChecked ? 1.0f : 0.0f);
            return;
        }
        ˋ(isChecked);
    }

    protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
        int max;
        int paddingLeft;
        int paddingTop;
        int i5 = 0;
        super.onLayout(z, i, i2, i3, i4);
        if (this.ˊ != null) {
            Rect rect = this.ˎˏ;
            if (this.ʽ != null) {
                this.ʽ.getPadding(rect);
            } else {
                rect.setEmpty();
            }
            Rect ˏ = cl.ˏ(this.ˊ);
            max = Math.max(0, ˏ.left - rect.left);
            i5 = Math.max(0, ˏ.right - rect.right);
        } else {
            max = 0;
        }
        if (de.ˎ(this)) {
            paddingLeft = getPaddingLeft() + max;
            max = ((this.ˊᐝ + paddingLeft) - max) - i5;
            i5 = paddingLeft;
        } else {
            paddingLeft = (getWidth() - getPaddingRight()) - i5;
            i5 += max + (paddingLeft - this.ˊᐝ);
            max = paddingLeft;
        }
        switch (getGravity() & 112) {
            case 16:
                paddingTop = (((getPaddingTop() + getHeight()) - getPaddingBottom()) / 2) - (this.ˉ / 2);
                paddingLeft = this.ˉ + paddingTop;
                break;
            case 80:
                paddingLeft = getHeight() - getPaddingBottom();
                paddingTop = paddingLeft - this.ˉ;
                break;
            default:
                paddingTop = getPaddingTop();
                paddingLeft = this.ˉ + paddingTop;
                break;
        }
        this.ˋˊ = i5;
        this.ˎˎ = paddingTop;
        this.ˌ = paddingLeft;
        this.ˋˋ = max;
    }

    public void draw(Canvas canvas) {
        Rect ˏ;
        int i;
        Rect rect = this.ˎˏ;
        int i2 = this.ˋˊ;
        int i3 = this.ˎˎ;
        int i4 = this.ˋˋ;
        int i5 = this.ˌ;
        int ʽ = i2 + ʽ();
        if (this.ˊ != null) {
            ˏ = cl.ˏ(this.ˊ);
        } else {
            ˏ = cl.ˎ;
        }
        if (this.ʽ != null) {
            this.ʽ.getPadding(rect);
            int i6 = rect.left + ʽ;
            if (ˏ != null) {
                if (ˏ.left > rect.left) {
                    i2 += ˏ.left - rect.left;
                }
                if (ˏ.top > rect.top) {
                    ʽ = (ˏ.top - rect.top) + i3;
                } else {
                    ʽ = i3;
                }
                if (ˏ.right > rect.right) {
                    i4 -= ˏ.right - rect.right;
                }
                i = ˏ.bottom > rect.bottom ? i5 - (ˏ.bottom - rect.bottom) : i5;
            } else {
                i = i5;
                ʽ = i3;
            }
            this.ʽ.setBounds(i2, ʽ, i4, i);
            i = i6;
        } else {
            i = ʽ;
        }
        if (this.ˊ != null) {
            this.ˊ.getPadding(rect);
            i2 = i - rect.left;
            i = (i + this.ˊˋ) + rect.right;
            this.ˊ.setBounds(i2, i3, i, i5);
            Drawable background = getBackground();
            if (background != null) {
                gg.ˏ(background, i2, i3, i, i5);
            }
        }
        super.draw(canvas);
    }

    protected void onDraw(Canvas canvas) {
        int save;
        super.onDraw(canvas);
        Rect rect = this.ˎˏ;
        Drawable drawable = this.ʽ;
        if (drawable != null) {
            drawable.getPadding(rect);
        } else {
            rect.setEmpty();
        }
        int i = this.ˎˎ + rect.top;
        int i2 = this.ˌ - rect.bottom;
        Drawable drawable2 = this.ˊ;
        if (drawable != null) {
            if (!this.ॱˋ || drawable2 == null) {
                drawable.draw(canvas);
            } else {
                Rect ˏ = cl.ˏ(drawable2);
                drawable2.copyBounds(rect);
                rect.left += ˏ.left;
                rect.right -= ˏ.right;
                save = canvas.save();
                canvas.clipRect(rect, Op.DIFFERENCE);
                drawable.draw(canvas);
                canvas.restoreToCount(save);
            }
        }
        save = canvas.save();
        if (drawable2 != null) {
            drawable2.draw(canvas);
        }
        Layout layout = ᐝ() ? this.ˏˏ : this.ˑ;
        if (layout != null) {
            int i3;
            int[] drawableState = getDrawableState();
            if (this.ˍ != null) {
                this.ˋᐝ.setColor(this.ˍ.getColorForState(drawableState, 0));
            }
            this.ˋᐝ.drawableState = drawableState;
            if (drawable2 != null) {
                rect = drawable2.getBounds();
                i3 = rect.right + rect.left;
            } else {
                i3 = getWidth();
            }
            canvas.translate((float) ((i3 / 2) - (layout.getWidth() / 2)), (float) (((i + i2) / 2) - (layout.getHeight() / 2)));
            layout.draw(canvas);
        }
        canvas.restoreToCount(save);
    }

    public int getCompoundPaddingLeft() {
        if (!de.ˎ(this)) {
            return super.getCompoundPaddingLeft();
        }
        int compoundPaddingLeft = super.getCompoundPaddingLeft() + this.ˊᐝ;
        if (TextUtils.isEmpty(getText())) {
            return compoundPaddingLeft;
        }
        return compoundPaddingLeft + this.ᐝॱ;
    }

    public int getCompoundPaddingRight() {
        if (de.ˎ(this)) {
            return super.getCompoundPaddingRight();
        }
        int compoundPaddingRight = super.getCompoundPaddingRight() + this.ˊᐝ;
        if (TextUtils.isEmpty(getText())) {
            return compoundPaddingRight;
        }
        return compoundPaddingRight + this.ᐝॱ;
    }

    private int ʽ() {
        float f;
        if (de.ˎ(this)) {
            f = 1.0f - this.ˏ;
        } else {
            f = this.ˏ;
        }
        return (int) ((f * ((float) ʼ())) + 0.5f);
    }

    private int ʼ() {
        if (this.ʽ == null) {
            return 0;
        }
        Rect ˏ;
        Rect rect = this.ˎˏ;
        this.ʽ.getPadding(rect);
        if (this.ˊ != null) {
            ˏ = cl.ˏ(this.ˊ);
        } else {
            ˏ = cl.ˎ;
        }
        return ((((this.ˊᐝ - this.ˊˋ) - rect.left) - rect.right) - ˏ.left) - ˏ.right;
    }

    protected int[] onCreateDrawableState(int i) {
        int[] onCreateDrawableState = super.onCreateDrawableState(i + 1);
        if (isChecked()) {
            mergeDrawableStates(onCreateDrawableState, ͺॱ);
        }
        return onCreateDrawableState;
    }

    protected void drawableStateChanged() {
        super.drawableStateChanged();
        int[] drawableState = getDrawableState();
        int i = 0;
        Drawable drawable = this.ˊ;
        if (drawable != null && drawable.isStateful()) {
            i = 0 | drawable.setState(drawableState);
        }
        drawable = this.ʽ;
        if (drawable != null && drawable.isStateful()) {
            i |= drawable.setState(drawableState);
        }
        if (i != 0) {
            invalidate();
        }
    }

    public void drawableHotspotChanged(float f, float f2) {
        if (VERSION.SDK_INT >= 21) {
            super.drawableHotspotChanged(f, f2);
        }
        if (this.ˊ != null) {
            gg.ˋ(this.ˊ, f, f2);
        }
        if (this.ʽ != null) {
            gg.ˋ(this.ʽ, f, f2);
        }
    }

    protected boolean verifyDrawable(Drawable drawable) {
        return super.verifyDrawable(drawable) || drawable == this.ˊ || drawable == this.ʽ;
    }

    public void jumpDrawablesToCurrentState() {
        super.jumpDrawablesToCurrentState();
        if (this.ˊ != null) {
            this.ˊ.jumpToCurrentState();
        }
        if (this.ʽ != null) {
            this.ʽ.jumpToCurrentState();
        }
        if (this.ˋ != null && this.ˋ.isStarted()) {
            this.ˋ.end();
            this.ˋ = null;
        }
    }

    public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        super.onInitializeAccessibilityEvent(accessibilityEvent);
        accessibilityEvent.setClassName("android.widget.Switch");
    }

    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
        super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
        accessibilityNodeInfo.setClassName("android.widget.Switch");
        CharSequence charSequence = isChecked() ? this.ॱᐝ : this.ʻॱ;
        if (!TextUtils.isEmpty(charSequence)) {
            CharSequence text = accessibilityNodeInfo.getText();
            if (TextUtils.isEmpty(text)) {
                accessibilityNodeInfo.setText(charSequence);
                return;
            }
            CharSequence stringBuilder = new StringBuilder();
            stringBuilder.append(text).append(' ').append(charSequence);
            accessibilityNodeInfo.setText(stringBuilder);
        }
    }

    public void setCustomSelectionActionModeCallback(Callback callback) {
        super.setCustomSelectionActionModeCallback(TextViewCompat.ˏ(this, callback));
    }

    private static float ˋ(float f, float f2, float f3) {
        if (f < f2) {
            return f2;
        }
        return f > f3 ? f3 : f;
    }
}
